--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_komano_aun = General:new(extension, "hy_komano_aun", "ten_k", 4, 4, General.Female)
    local guard = fk.CreateSkill {
        name = "guard",
    }
    guard:addEffect(fk.DetermineDamageInflicted, {
        anim_type = "defensive",
        times = function(self, player)
            return 2 - player:usedSkillTimes(guard.name, Player.HistoryRound)
        end,
        can_trigger = function(self, event, target, player, data)
            if not target or not player:hasSkill(guard.name) or not player:inMyAttackRange(target) or player:usedSkillTimes(guard.name, Player.HistoryRound) >= 2 then
                return false
            end
            return data.card and data.card.trueName == "slash"
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            return room:askToSkillInvoke(player, {
                skill_name = guard.name,
                prompt = "guard_prompt1::" .. target.id
            })
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            if player:usedSkillTimes(guard.name, Player.HistoryRound) > 1 then
                room:loseHp(player, 1, guard.name)
            end
            data:preventDamage()
        end,
    })
    guard:addEffect(fk.CardEffecting, {
        anim_type = "defensive",
        times = function(self, player)
            return 2 - player:usedSkillTimes(guard.name, Player.HistoryRound)
        end,
        can_trigger = function(self, event, target, player, data)
            if not target or not player:hasSkill(guard.name) or not player:inMyAttackRange(target) or player:usedSkillTimes(guard.name, Player.HistoryRound) >= 2 then
                return false
            end
            if event == fk.DamageInflicted then
                return data.card and data.card.trueName == "slash"
            elseif event == fk.CardEffecting then
                return data.card.sub_type == Card.SubtypeDelayedTrick
            end
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            return room:askToSkillInvoke(player, {
                skill_name = guard.name,
                prompt = "guard_prompt2::" .. target.id .. ":" .. data.card:toLogString()
            })
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            if player:usedSkillTimes(guard.name, Player.HistoryRound) > 1 then
                room:loseHp(player, 1, guard.name)
            end
            data.nullified = true
        end,
    })
    local double_existence = fk.CreateSkill {
        name = "double_existence",
    }
    double_existence:addEffect(fk.CardUsing, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(double_existence.name) and player.phase == Player.Play and target == player and (data.card.type == Card.TypeBasic or data.card:isCommonTrick()) and
                #data:getAllTargets() == 1 and #player.room.logic:getEventsOfScope(GameEvent.UseCard, 3, function(e)
                    return e.data.from == player and (e.data.card.type == Card.TypeBasic or e.data.card:isCommonTrick())
                end, Player.HistoryPhase) < 3
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            event:setCostData(self, nil)
            if #room.logic:getEventsOfScope(GameEvent.UseCard, 3, function(e)
                    return e.data.from == player and (e.data.card.type == Card.TypeBasic or e.data.card:isCommonTrick())
                end, Player.HistoryPhase) == 1 then
                local targets = table.filter(room.alive_players, function(t)
                    return not player:isProhibited(t, data.card)
                end)
                event:setCostData(self, table.map(HY.AskForAddTarget(player, 1, false, true, "double_existence_prompt1:::" .. data.card:toLogString(), double_existence.name, data), Util.IdMapper))
                return #event:getCostData(self) > 0
            else
                return room:askToSkillInvoke(player, {
                    skill_name = double_existence.name,
                    prompt = "double_existence_prompt2:::" .. data.card:toLogString()
                })
            end
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            if event:getCostData(self) ~= nil then
                HY.ChangeTarget(data, table.map(event:getCostData(self), function(id)
                    return room:getPlayerById(id)
                end))
            else
                data.additionalEffect = (data.additionalEffect or 0) + 1
            end
        end,
    })
    double_existence:addEffect("atkrange", {
        correct_func = function(self, from, to)
            if from:hasSkill("double_existence") then
                return 1
            end
        end,
    })
    extension:loadSkillSkels { guard, double_existence }
    hy_komano_aun:addSkill("guard")
    hy_komano_aun:addSkill("double_existence")
    Fk:loadTranslationTable {
        ["hy_komano_aun"] = "高丽野阿吽",
        ["#hy_komano_aun"] = "二重石身",
        ["illustrator:hy_komano_aun"] = "JILL。",
        ["designer:hy_komano_aun"] = "碧珞",
        ["cv:hy_komano_aun"] = "",

        ["guard"] = "守护",
        [":guard"] = "每轮限两次，当你攻击范围内的一名其他角色受到【杀】的伤害时/的延时锦囊生效时，你可以防止此伤害/令此牌无效。若此次不是你本轮首次发动“守护”，你失去1点体力。",
        ["guard_prompt1"] = "守护：你可以防止对%dest的伤害",
        ["guard_prompt2"] = "守护：你可以令对%dest的%arg无效",

        ["double_existence"] = "重身",
        [":double_existence"] = "你的攻击范围+1。当你于出牌阶段使用第一/二张基本牌或普通锦囊牌时，若此牌指定了唯一目标，你可令此牌目标数+1/额外结算一次。",
        ["double_existence_prompt1"] = "重身：你可以为%arg多指定一个目标",
        ["double_existence_prompt2"] = "重身：你可以令%arg额外结算一次",
    }
end
